package com.example.userservice.client;

import com.example.homeworkservice.entity.homework;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(name = "homework-service", url = "http://localhost:8184")
public interface HomeworkClient {
    
    // 创建作业
    @PostMapping("/api/homework/create")
    String createHomework(@RequestBody Map<String, Object> requestBody);
    
    // 获取课程的作业列表
    @GetMapping("/api/homework/course/{courseId}")
    List<homework> getCourseHomeworks(@PathVariable int courseId);
    
    // 获取作业详情
    @GetMapping("/api/homework/{homeworkId}")
    homework getHomeworkDetail(@PathVariable int homeworkId);
    
    // 更新作业
    @PutMapping("/api/homework/update")
    String updateHomework(@RequestBody Map<String, Object> requestBody);
    
    // 删除作业
    @DeleteMapping("/api/homework/{homeworkId}")
    String deleteHomework(@PathVariable int homeworkId);
    
    // 学生提交作业
    @PostMapping("/api/homework/submit")
    String submitHomework(@RequestBody Map<String, Object> requestBody);
    
    // 获取学生的作业提交记录
    @GetMapping("/api/homework/submissions/student/{userId}")
    List<Map<String, Object>> getStudentSubmissions(@PathVariable int userId);
    
    // 获取学生应该看到的所有作业
    @GetMapping("/api/homework/student/{userId}")
    List<Map<String, Object>> getStudentHomeworks(@PathVariable int userId);
    
    // 获取作业的所有提交记录
    @GetMapping("/api/homework/submissions/homework/{homeworkId}")
    List<Map<String, Object>> getHomeworkSubmissions(@PathVariable int homeworkId);
    
    // 获取学生特定作业的提交记录
    @GetMapping("/api/homework/submissions/student/{userId}/homework/{homeworkId}")
    Map<String, Object> getStudentHomeworkSubmission(@PathVariable int userId, @PathVariable int homeworkId);
    
    // 教师批改作业
    @PutMapping("/api/homework/grade")
    String gradeHomework(@RequestBody Map<String, Object> requestBody);
}
